﻿@model IEnumerable<Microsoft.Online.Demos.Aadexpense.ServiceReference1.User>

@{
    ViewBag.Title = "Users";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Users</h2>

<script src="@Url.Content("https://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("https://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<table>
<tr>
@if (ViewBag.HasPrevPage != null && ViewBag.HasPrevPage == true)
{
    <td>@Html.ActionLink("Prev", "Users", new { type = "prev" })</td>
}
@if (ViewBag.HasNextPage != null && ViewBag.HasNextPage == true)
{
    <td>@Html.ActionLink("Next", "Users", new { type = "next" })</td>
}
@if (ViewBag.FilteredUserView != null && ViewBag.FilteredUserView == true)
{
    using (Html.BeginForm())
    {    
             <p> Title: @Html.TextBox("SearchString")  
             <input type="submit" value="Filter" /></p> 
    }
}
</tr>
</table>
<br />
<table>
    <tr>
        <th>
            DisplayName
        </th>        
        <th>
            UserPrincipalName
        </th>
        <th>
            Add to application
        </th>
    </tr>

@if (Model != null)
{
    foreach (var item in Model)
    {
    <tr>
        <td>
            @Html.ActionLink(item.DisplayName, "UserDetails", new { id = item.ObjectId })
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.UserPrincipalName)
        </td>
        <td>
            @Html.CheckBox("Enable")
        </td>
    </tr>
    }
}
</table>

<p>    
    @Html.ActionLink("Back to Views", "Index")
</p>
